home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
ZINC.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-31
|
12KB
|
383 lines
#ifndef _ZINC_HPP_
#define _ZINC_HPP_
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: zinc.hpp
// Title: Zinc 3.5 Interface library
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module is the primary header file for the Zinc Framework interface.
// This module should be included by all modules which use Zinc.
// This module includes the base library header files.
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS and Windows
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
#include <class.hpp>
//----------------------------------------------------------------------------
// Constants
//----------------------------------------------------------------------------
#define MAX_HELPBAR (256)
//
// Special values for buttons and menu items.
// Other special messages start at 10000.
//
enum _ZN_MSG // Internal Zinc interface library
{ // message
ZN_MSG_USER = 10000, // User messages
ZN_MSG_UNKNOWN = 20000,
ZN_MSG_INIT, // Window initialize
ZN_MSG_TERMINATE, // Window terminate
ZN_MSG_STRING_CHANGE, // Key pressed in string box
ZN_MSG_STRING_SELECT, // Enter pressed in string box
ZN_MSG_VLIST_INIT, // Intialize virtual list
ZN_MSG_VLIST_QUERY, // Query element
ZN_MSG_VLIST_SELECT, // Element selected/unselected
ZN_MSG_VLIST_DBL_CLK, // Virtual list double click
ZN_MSG_VLIST_CURRENT, // Current list element has changed
ZN_MSG_VLIST_TITLE, // Get virtual list title
ZN_MSG_HELP, // Query help context
ZN_MSG_LIST_SELECT, // List element select
ZN_MSG_LIST_DBL_CLK, // List element double click
ZN_MSG_NO_HELP, // Ignore this help context
// pv2 is buffer to fill with text
ZN_MSG_MAX,
ZN_CMD_CLOSE = 30001, // Close window
ZN_CMD_EXIT_RQ = 30002, // Request application exit
ZN_CMD_EXIT = 30003, // Exit application
ZN_CMD_HELP = 30004, // Display help
ZN_CMD_OK = 30101, // Message box OK
ZN_CMD_CANCEL = 30102, // Message box Cancel
ZN_CMD_YES = 30103, // Message box Yes
ZN_CMD_NO = 30104, // Message box No
ZN_CMD_MAX
};
typedef USHORT ZN_MSG; // Zinc message
BASETYPE(ZN_MSG);
typedef USHORT ZN_HELP; // Help context
BASETYPE(ZN_HELP);
typedef USHORT ZN_FLD; // Field id
BASETYPE(ZN_FLD);
#define ZN_VLIST_SINGLE (0) // List allow only a single selection
#define ZN_VLIST_MULTI (1) // List allows multiple selections
#define ZN_VLIST_TITLE (2) // List has title
// NOTE: Currently a list MUST have a title
struct ZN_VLIST_INIT // This structure must be filled in
{ // by the user
LONG lElems; // Number of elements
int *aiTabstops; // Tab stops
FLAG16 fs; // Flags: VLIST_SINGLE
// VLIST_MULTI
};
BASETYPE(ZN_VLIST_INIT);
struct ZN_VLIST_ELEM // List element
{
LONG lId; // Element number
BOOL fSelected; // Element selected
PSZ pszBuf; // Element text
SIZET cBuf; // INTERNAL - Size of allocated buffer
USHORT usUsed; // INTERNAL - Usage count
};
BASETYPE(ZN_VLIST_ELEM);
//
// Flags for window create and load functions.
//
#define ZN_LOAD_CENTER (0x10000000L)
#define ZN_LOAD_HELPBAR (0x20000000L)
#define ZN_LOAD_NO_SHOW (0x40000000L)
#define ZN_LOAD_VL_SIZE(x,y) ((0x80000000L)\
|((((ULONG)(y)) & 0x07FL)<<16)\
|(((ULONG)(x)) & 0x0FFFFL))
#define ZN_LOAD_NO_VL_TITLE (0x08000000L) // No title bar
#define ZN_LOAD_NO_VL_TB (0x04000000L) // Don't resize to fit tool bar
#define ZN_LOAD_NO_VL_HB (0x02000000L) // Don't resize to fit help bar
#define ZN_LOAD_NO_VL_SB (0x01000000L) // Don't move scroll bar left/right
#define ZN_LOAD_VL_BORDER (0x00800000L) // Border
#define ZN_LOAD_VL_X(fl) ((ULONG)(fl) & 0x0FFFFL)
#define ZN_LOAD_VL_Y(fl) (((ULONG)(fl) >> 16) & 0x07FL)
//
// These types are defined here so that the entire
// Zinc header file is not included in applications.
//
#ifndef INCL_ZINC_INTERFACE
typedef USHORT UI_HELP_CONTEXT;
typedef USHORT OBJECTID;
#endif
enum _ZN_MOUSE
{
MOUSE_DEFAULT = 0,
MOUSE_HOURGLASS,
MOUSE_MAX
};
typedef USHORT ZN_MOUSE; // Zinc message
BASETYPE(ZN_MOUSE);
//
// Mapping object for help bar. Maps a window help context to
// a string.
//
struct ZN_HELPMAP
{
ZN_HELP help;
PSZ psz;
};
BASETYPE(ZN_HELPMAP);
//
// List element string
//
struct ZN_LISTELEM
{
PCSZ pcsz; // List text
ZN_MSG msg; // List item value
PCSZ pcszBitmap; // Bitmap name or NULL.
};
BASETYPE(ZN_LISTELEM);
#define ZN_MBOX_OK (0x0000) // Message box types
#define ZN_MBOX_OKCANCEL (0x0001)
#define ZN_MBOX_YESNO (0x0002)
#define ZN_MBOX_DFT1 (0x0000) // Default button 1
#define ZN_MBOX_DFT2 (0x0010) // Default button 2
#define ZN_MID_OK (0) // Message box result ids
#define ZN_MID_CANCEL (1)
#define ZN_MID_YES (2)
#define ZN_MID_NO (3)
#define ZN_MID_ERROR (4) // Message box error
typedef PCSZ FIELDID; // Field id type
#define FID(id) ((FIELDID)US2P(id))
//
// ZincMain() mode constants
//
#define ZINC_INITIALIZE (0)
#define ZINC_TERMINATE (1)
//
// String colors
//
enum ZN_COLOR
{
ZN_CLR_BLACK,
ZN_CLR_DFT = ZN_CLR_BLACK,
ZN_CLR_FIRST = ZN_CLR_DFT,
ZN_CLR_BLUE,
ZN_CLR_GREEN,
ZN_CLR_CYAN,
ZN_CLR_RED,
ZN_CLR_MAGENTA,
ZN_CLR_BROWN,
ZN_CLR_LIGHTGRAY,
ZN_CLR_DARKGRAY,
ZN_CLR_LIGHTBLUE,
ZN_CLR_LIGHTGREEN,
ZN_CLR_LIGHTCYAN,
ZN_CLR_LIGHTRED,
ZN_CLR_LIGHTMAGENTA,
ZN_CLR_YELLOW,
ZN_CLR_WHITE,
ZN_CLR_LAST = ZN_CLR_WHITE
};
BASETYPE(ZN_COLOR);
//----------------------------------------------------------------------------
// ZN_WINDOW
//----------------------------------------------------------------------------
CLASSDEF(ZN_WINDOW);
class CLASSTYPE ZN_WINDOW : public CL_OBJECT
{
BOOL fInit;
PVOID pvWindow; // Pointer to actual window
PCSZ _pcsz;
FLAG32 _fl;
public:
BOOL fDialog;
FN_M ZN_WINDOW(PCSZ, FLAG32 = ZN_LOAD_CENTER);
virtual FN_M ~ZN_WINDOW();
VOID FN_M Close();
VOID FN_M ContextHelp(ZN_HELP);
ZN_MSG FN_M Dialog();
VOID FN_M DialogExit(ZN_MSG = 0);
BOOL FN_M Enable(FIELDID, BOOL = TRUE);
VOID FN_M Exit();
VOID FN_M ExitRequest();
BOOL FN_M GetButtonState(FIELDID, PBOOL = NULL);
PCSZ FN_M GetComboSel(FIELDID);
ZN_FLD FN_M GetCurrent();
BOOL FN_M GetDate(FIELDID, RTIMET);
PCSZ FN_M GetFormattedString(FIELDID, BOOL = FALSE);
PCSZ FN_M GetHzListSel(FIELDID);
ZN_MSG FN_M GetHzListSelId(FIELDID);
PVOID FN_M GetIconBitmap(FIELDID);
PCSZ FN_M GetNumber(FIELDID, PSZ, SHORT = 0, FLAG16 = 0);
PCSZ FN_M GetString(FIELDID);
PCSZ FN_M GetText(FIELDID, PSZ = NULL);
BOOL FN_M GetTime(FIELDID, RTIMET);
PCSZ FN_M GetVtListSel(FIELDID);
ZN_MSG FN_M GetVtListSelId(FIELDID);
VOID FN_M Help(PZN_HELPMAP, ZN_HELP, PSZ);
BOOL FN_M IsDialog() const
{
return fDialog;
}
virtual BOOL FN_M IsValid() const
{
return pvWindow != NULL && CL_OBJECT::IsValid();
}
PVOID FN_M LoadBitmap(PCSZ);
BOOL FN_M LoadButtonBitmap(FIELDID, PCSZ);
PVOID FN_M LoadIcon(PCSZ = NULL);
BOOL FN_M LoadIconBitmap(FIELDID, PCSZ = NULL, BOOL = TRUE);
VOID FN_M Maximize();
VOID FN_M Minimize();
PCSZ FN_M Name(FIELDID = NULL);
VOID FN_M NotDone();
ZN_FLD FN_M Number(FIELDID = NULL);
BOOL FN_M Paste(PCSZ);
BOOL FN_M PostMessage(FIELDID, ZN_MSG, PVOID, PVOID);
static VOID FN_M Process();
static ZN_MSG FN_M SendMessage(PCSZ, ZN_MSG, PVOID = NULL, PVOID = NULL);
BOOL FN_M SetButtonBitmap(FIELDID, PVOID);
BOOL FN_M SetButtonState(FIELDID, BOOL);
BOOL FN_M SetButtonText(FIELDID, PCSZ);
BOOL FN_E SetComboList(FIELDID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
BOOL FN_E SetComboList(FIELDID, PPSZ);
BOOL FN_E SetComboList(FIELDID, PZN_LISTELEM);
BOOL FN_M SetComboSel(FIELDID, PCSZ);
VOID FN_M SetCurrent(FIELDID);
BOOL FN_M SetDate(FIELDID, TIMET = 0);
BOOL FN_M SetFormattedString(FIELDID, PCSZ = NULL);
BOOL FN_M SetGreyState(FIELDID, BOOL);
VOID FN_M SetHelp(PCSZ = NULL, BOOL = FALSE);
BOOL FN_E SetHzList(FIELDID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
BOOL FN_E SetHzList(FIELDID, PPSZ);
BOOL FN_E SetHzList(FIELDID, PZN_LISTELEM);
BOOL FN_M SetIconBitmap(FIELDID, PVOID, BOOL = TRUE);
static BOOL FN_M SetMouse(ZN_MOUSE = MOUSE_DEFAULT);
BOOL FN_M SetNumber(FIELDID, LONG);
BOOL FN_M SetNumber(FIELDID, PCSZ);
BOOL FN_M SetNumberRange(FIELDID, PCSZ);
BOOL FN_M SetPrompt(FIELDID, PCSZ = NULL);
BOOL FN_M SetString(FIELDID, PCSZ = NULL);
BOOL FN_M SetStringColor(FIELDID, ZN_COLOR = ZN_CLR_DFT);
BOOL FN_M SetText(FIELDID, PCSZ = NULL, SHORT = -1);
BOOL FN_M SetTime(FIELDID, TIMET = 0);
VOID FN_M SetTitle(PCSZ);
VOID FN_M SetVlistPos(LONG);
VOID FN_M SetVlistSize(LONG);
BOOL FN_E SetVtList(FIELDID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
BOOL FN_E SetVtList(FIELDID, PPSZ);
BOOL FN_E SetVtList(FIELDID, PZN_LISTELEM);
BOOL FN_M SetVtListSel(FIELDID, ZN_MSG);
BOOL FN_M Setup();
VOID FN_M Show();
BOOL FN_M Terminate();
virtual ZN_MSG FN_M User(ZN_MSG, PVOID = NULL, PVOID = NULL);
VOID FN_M VlistRefresh();
protected:
PVOID FN_M Find(FIELDID, USHORT = 0);
BOOL FN_E _SetComboList(PVOID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
BOOL FN_E _SetHzList(PVOID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
BOOL FN_E _SetVtList(PVOID, PCSZ, ZN_MSG = 0, PCSZ = NULL);
};
//----------------------------------------------------------------------------
// Prototypes
//----------------------------------------------------------------------------
//
// znmem.cpp
//
extern USHORT usMemRequired;
//
// User defined!
// This function must be declared in any application which uses the zinc
// interface library. This function is called at startup after Zinc is
// initialized and again right before termination.
//
// The single parameter is ZINC_INITIALIZE at startup and
// ZINC_TERMINATE at termination.
//
BOOL FN_E ZincMain(SHORT);
//
// znmain.cpp
//
#define ZN_ML_WAIT (0x0001)
#define ZN_ML_DIALOG (0x0002)
VOID FN_E ZincMessageLoop(FLAG16 = ZN_ML_WAIT);
//
// znload.cpp
// Load a zinc window from disk.
//
BOOL FN_E ZincWindow(PCSZ, FLAG32 = ZN_LOAD_CENTER);
//
// znmsg.cpp
//
ZN_MSG FN_EV ZincMessageBox(PCSZ, FLAG16, PCSZ, ...);
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------
#endif // _ZINC_HPP_